<template>
  <div style="padding: 20px">
    <div class="b" style="text-align: center; margin-bottom: 15px">
      用药建议
    </div>
    <el-input
      v-loading="loading"
      :rows="12"
      type="textarea"
      style="width: 100%"
      v-model="form.suggestContent"
      placeholder=""
    />
    <div class="mt20" style="text-align: center">
      <el-button
        style="background-color: #1292b9; color: #fff; height: 36px"
        @click="saveYongyaojianyi"
        >保存</el-button
      >
    </div>
  </div>
</template>

<script>
import { updatepillSuggest, pillSuggest } from "@/api/workstation/baseInfo";
export default {
  data() {
    return {
      medicalRecordNo: "", // 路由传过来的药历号
      loading: true,
      form: {
        id: "",
        medicalRecordNo: this.$route.query.medicalRecordNo,
        suggestContent: "",
      },
    };
  },
  created() {
    this.medicalRecordNo = this.$route.query.medicalRecordNo + "";
    // this.getList();
  },
  methods: {
    /** 查询用药咨询列表 */
    getList() {
      this.loading = true;
      pillSuggest(this.medicalRecordNo)
        .then((response) => {
          if (response.data !== null) {
            this.form = response.data;
          }
        })
        .finally(() => (this.loading = false));
    },
    saveYongyaojianyi() {
      updatepillSuggest(this.form).then((res) => {
        if (res.code == 200) {
          this.$modal.msgSuccess("保存成功");
        } else {
          this.$modal.msgError(res.msg);
        }
      });
    },
  },
};
</script>

<style lang="scss" scoped></style>
